/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-11-28     Administrator       the first version
 */
#ifndef APPLICATIONS_GLOBAL_VARIABLE_H_
#define APPLICATIONS_GLOBAL_VARIABLE_H_


#include <rtdef.h>


#ifdef __cplusplus
extern "C" {
#endif

typedef struct MECHINE_INFO
{
   rt_uint8_t addr;
}MECHINE_INFO;


typedef struct LOG
{
  char name[10];
  rt_uint8_t type;
  rt_uint8_t act;
  rt_int8_t state;
  rt_uint32_t para;
}LOG;

typedef struct SEM_MOTOR
{
    rt_sem_t liquidDet_start;
    rt_sem_t liquidDet_finished;
    rt_sem_t goHome_finished;
    rt_sem_t goHome_start;
    rt_sem_t RunFinished;
    rt_sem_t RunStart;
}SEM_MOTOR;


typedef struct TASK
{
    /* 日志控制句柄  */
    rt_thread_t LogHandle;
    /* LED控制句柄  */
    rt_thread_t RunLEDHandle;
    rt_thread_t ErrLEDHandle;
    /* 电机控制句柄  */
    rt_thread_t MotorDirverHandle[7];
    /* 时序控制句柄  */
    rt_thread_t ActionQueueHandle[20];
    /* 继续添加 */
}TASK;





//extern function
rt_uint8_t thread_create(void);
void GlobalVarInit(void);
void DelayMs(rt_uint32_t ms);


//extern Var
extern MECHINE_INFO machine_info;
extern TASK task;
extern SEM_MOTOR sem_motor[7];
extern rt_mq_t LogMqHandle;

#ifdef __cplusplus
}
#endif

#endif /* APPLICATIONS_GLOBAL_VARIABLE_H_ */
